import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { MemberUserTransVO, MemberUserTransForm, MemberUserTransQuery } from '@/api/member/memberUserTrans/types';

/**
 * 查询用户交易记录列表
 * @param query
 * @returns {*}
 */

export const listMemberUserTrans = (query?: MemberUserTransQuery): AxiosPromise<MemberUserTransVO[]> => {
  return request({
    url: '/member/memberUserTrans/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询用户交易记录详细
 * @param transId
 */
export const getMemberUserTrans = (transId: string | number): AxiosPromise<MemberUserTransVO> => {
  return request({
    url: '/member/memberUserTrans/' + transId,
    method: 'get'
  });
};

/**
 * 新增用户交易记录
 * @param data
 */
export const addMemberUserTrans = (data: MemberUserTransForm) => {
  return request({
    url: '/member/memberUserTrans',
    method: 'post',
    data: data
  });
};

/**
 * 修改用户交易记录
 * @param data
 */
export const updateMemberUserTrans = (data: MemberUserTransForm) => {
  return request({
    url: '/member/memberUserTrans',
    method: 'put',
    data: data
  });
};

/**
 * 删除用户交易记录
 * @param transId
 */
export const delMemberUserTrans = (transId: string | number | Array<string | number>) => {
  return request({
    url: '/member/memberUserTrans/' + transId,
    method: 'delete'
  });
};
